package com.demo.lcgl.controller;

import java.io.IOException;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.demo.lcgl.controller.base.BaseController;
import com.demo.lcgl.entity.InvestmentAndFinancing;
import com.demo.lcgl.service.InvestmentAndFinancingService;

/**
 * 投资理财：(InvestmentAndFinancing)表控制层
 */
@RestController
@RequestMapping("/investment_and_financing")
public class InvestmentAndFinancingController extends BaseController<InvestmentAndFinancing, InvestmentAndFinancingService> {

    /**
     * 投资理财对象
     */
    @Autowired
    public InvestmentAndFinancingController(InvestmentAndFinancingService service) {
        setService(service);
    }

    @PostMapping("/add")
    @Transactional
    public Map<String, Object> add(HttpServletRequest request) throws IOException {
        Map<String, Object> paramMap = service.readBody(request.getReader());
        this.addMap(paramMap);
        return success(1);
    }

}
